<?php
require_once("/home/bluecbhv/Back-End/Jcuhelpers-WebTech/Content_Scraper/Content_Scraper.php");
require_once("/home/bluecbhv/Back-End/Jcuhelpers-WebTech/Keywords_Identifier/DOM_API.php");
require_once("/home/bluecbhv/Back-End/Jcuhelpers-WebTech/Keywords_Identifier/Keywords_Filter.php");

/***********************************************
	This class would identify the relevant
	keywords in the article.
************************************************/
class KeywordsIdentifier extends KeywordsFilter {
	private $scrapedContent = NULL;
	private $articleKeywords = NULL;
	private $relevantKeywords = NULL;
	private $relevantKeywordsArray = NULL;
	
	/************************************************************/
	
	function getRelevantKeywords($link) {
		$this->relevantKeywordsArray = array();
		
		$csObj = new ContentScraper();
		$this->scrapedContent = $csObj->scrapeContent($link);
		
		$daObj = new DomApi($this->scrapedContent);
		$this->articleKeywords = $daObj->getArticleKeywords();
		
		foreach ($this->articleKeywords as $keywords) {
			$this->relevantKeywords = parent::filterKeywords($keywords->nodeValue);
			
			if ($this->relevantKeywords != FALSE) {
				array_push($this->relevantKeywordsArray, $this->relevantKeywords);
			}
		}
		return $this->relevantKeywordsArray;
	}
}
?>